|
|
|
|
|
|
|
Data1.Recordset.Update ' write record to table
'
nAddRec = False
'
End Sub |
|
|
|
|
|
|
|
|
Listing 5.53 contains the code that should now be entered into the cmdDelete_Click event. This code deletes the displayed record after the user confirms the deletion. |
|
|
|
|
|
|
|
|
Listing 5.53. Deleting a record. |
|
|
|
|
|
|
|
|
Private Sub cmdDelete_Click()
'
Dim nResult As Integer
'
' give user chance to reconsider
nResult = MsgBox("Are you sure?", 1, "Delete Record")
If nResult = 1 Then
Data1.Recordset.Delete
Data1.Recordset.MoveFirst
End If
'
End Sub |
|
|
|
|
|
|
|
|
You need to add code behind the Image control to allow users to update the CompanyLogo field. Users should be able to locate a file on the disk, and then save it to the field. The form then displays the saved image. You can give users access to loading files by adding the Visual Basic 5 CommonDialog control to the form. Select the CommonDialog control from the Tools window and place it at the bottom of the form. It does not really matter where it is placedthe CommonDialog control is invisible at runtime. Once the control is on the form, add the code in Listing 5.54 to the Image1_DblClick event. |
|
|
|
|
|
|
|
|
Listing 5.54. Updating the company logo. |
|
|
|
|
|
|
|
|
Private Sub Image1_DblClick()
'
' set dialog properties
CMDialog1.Filter = "Bitmap (*.bmp)|*.bmp|Metafiles (*.wmf)|*.wmf|"
CMDialog1.DialogTitle = "Load Company Logo"
'
' run dialog box
CMDialog1.Action = 1
'
' if they picked a file, load it up |
|
|
|
|
|